package com.tiyende.credit.loop.sdk.dec.userdec

import android.content.Context
import android.os.Build
import com.google.gson.Gson
import com.tiyende.credit.loop.sdk.dec.userdec.TiyendeUserDecDataUtils.getUserDec58

/**
 * hardware
 */
class TiyendeUserDecType3(val context: Context) {

    fun getUserDecType3Data(): String? {
        return try {
           val data = hashMapOf<String, Any>().apply {
                put("operatingSystem", "ANDROID")
                put("model", Build.MODEL.toString())
                put("serial", "")
                put("productionDate", Build.TIME.toString())
                put("sdkVersion", Build.VERSION.SDK_INT.toString())
                put("phoneType", TiyendeUserDecDataUtils.getUserDec2(context))
                put("versionCode", TiyendeUserDecDataUtils.getUserDec14(context))
                put("versionName", TiyendeUserDecDataUtils.getUserDec13(context))
                put("androidId", TiyendeUserDecDataUtils.getUserDec1(context))
                put("telephony", TiyendeUserDecDataUtils.getUserDec9(context))
                put("isVpn", TiyendeUserDecDataUtils.getUserDec39(context))
                put("isProxyPort", TiyendeUserDecDataUtils.getUserDec40())
                put("isDebug", TiyendeUserDecDataUtils.getUserDec10(context))
                put("simState", TiyendeUserDecDataUtils.getUserDec15(context))
                put("root", TiyendeUserDecDataUtils.getUserDec25())
                put("physicalSize", TiyendeUserDecDataUtils.getUserDec34(context))
                put("displayLanguage", TiyendeUserDecDataUtils.getUserDec4())
                put("iso3Language", TiyendeUserDecDataUtils.getUserDec5())
                put("iso3Country", TiyendeUserDecDataUtils.getUserDec6())
                put("networkOperatorName", TiyendeUserDecDataUtils.getUserDec9(context))
                put("networkType", TiyendeUserDecDataUtils.getUserDec8(context))
                put("timeZoneId", TiyendeUserDecDataUtils.getUserDec7())
                put("elapsedRealtime", TiyendeUserDecDataUtils.getUserDec11())
                put("sensorList", TiyendeUserDecDataUtils.getUserDec20(context))
                put("lastBootTime", TiyendeUserDecDataUtils.getUserDec12())
                put("rootJailbreak", TiyendeUserDecDataUtils.getUserDec25())
                put("keyboard", TiyendeUserDecDataUtils.getUserDec26(context))
                put("isSimulator", TiyendeUserDecDataUtils.getUserDec27())
                put("dbm", TiyendeUserDecDataUtils.getUserDec28(context)) //
                put("phoneNumber", "")
            }
            Gson().toJson(data).trim().getUserDec58()

        } catch (e: java.lang.Exception) {
            null
        }
    }
}